﻿@using Microsoft.AspNetCore.Mvc.Localization
@using Reborn.IdentityServer4.Admin.BusinessLogic.Shared.Dtos.Common
@using Reborn.IdentityServer4.Admin.UI.Configuration.Constants
@model Reborn.IdentityServer4.Admin.BusinessLogic.Identity.Dtos.Grant.PersistedGrantsDto
@inject IViewLocalizer Localizer

@{
    ViewBag.Title = Localizer["PageTitle"];
    Layout = "_Layout";
}

<div class="row">
    <div class="col-12 mb-3 text-center mt-1">
        <h2>
            <span class="oi oi-key" title="Persisted Grants" aria-hidden="true"></span> @Localizer["PageTitle"]
        </h2>
    </div>
</div>

<div class="row">
    <div class="col-12 mb-3">
        @await Html.PartialAsync("Common/Search", new Search { Action = "PersistedGrants", Controller = "Grant" })
    </div>
</div>

<div class="row table-responsive">
    <div class="col-12">
        <table class="table table-striped">
            <thead>
            <tr>
                <th></th>
                <th>@Localizer["TableSubjectId"]</th>
                <th>@Localizer["TableSubjectName"]</th>
            </tr>
            </thead>

            <tbody>
            @foreach (var persistedGrant in Model.PersistedGrants)
            {
                <tr>
                    <th scope="row">
                        <a asp-area="@CommonConsts.AdminUIArea" class="btn btn-primary" asp-action="PersistedGrant" asp-route-id="@persistedGrant.SubjectId">@Localizer["TableButtonDetail"]</a>
                    </th>
                    <td>@persistedGrant.SubjectId</td>
                    <td>@persistedGrant.SubjectName</td>
                </tr>
            }
            </tbody>
        </table>
    </div>
</div>

<div class="row">
    <div class="col-12">
        @await Html.PartialAsync("Common/Pager", new Pager { Action = "PersistedGrants", PageSize = Model.PageSize, TotalCount = Model.TotalCount })
    </div>
</div>